home *** CD-ROM | disk | FTP | other *** search
/ Chip 2000 February / OpenLinux 2.3 CD.iso / live / usr / share / vim / syntax / cpp.vim < prev    next >
Encoding:
Text File  |  1999-08-10  |  1.8 KB  |  56 lines

  1. " Vim syntax file
  2. " Language:    C++
  3. " Maintainer:    Ken Shan <ken@digitas.harvard.edu>
  4. " Last change:    1998 Jan 9
  5.  
  6. " Remove any old syntax stuff hanging around
  7. syn clear
  8.  
  9. " Read the C syntax to start with
  10. source <sfile>:p:h/c.vim
  11.  
  12. " C++ extentions
  13.  
  14. syn keyword cppStatement    new delete this
  15. syn keyword cppStatement    template operator friend typename
  16. syn keyword cppScopeDecl    public protected private
  17. syn keyword cppType        inline virtual bool
  18. syn keyword cppExceptions    throw try catch
  19. syn match cppCast        "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*<"me=e-1
  20. syn match cppCast        "\<\(const\|static\|dynamic\|reinterpret\)_cast\s*$"
  21. syn keyword cppCast        explicit
  22. syn keyword cppStorageClass    mutable
  23. syn keyword cppNumber    NPOS
  24. syn keyword cppBoolean    true false
  25.  
  26. syn match cppClassPreDecl "^\s*\(class\|struct\)\s\+[a-zA-Z_][a-zA-Z0-9_:]*\s*;"
  27. syn match cppClassDecl      "^\s*\(class\|struct\)\s\+[a-zA-Z_][a-zA-Z0-9_:]*"
  28.  
  29. " Functions ...
  30. syn match cppFunction  "^[a-zA-Z_][a-zA-Z0-9_<>:]*\s*("me=e-1
  31. syn match cppMethod  "^[a-zA-Z_][a-zA-Z0-9_<>:]*::\~\=[a-zA-Z0-9_<>:]\+\s*("me=e-1
  32.  
  33. syn match cppMethodWrapped contained  "[a-zA-Z_][a-zA-Z0-9_<>:]*::[a-zA-Z0-9_<>:]\+"
  34. syn match cppMethodWrap  "^[a-zA-Z_][a-zA-Z0-9_<>:]*\s\+[a-zA-Z_][a-zA-Z0-9_<>:]*::[a-zA-Z0-9_<>:]\+\s*("me=e-1 contains=cppMethodWrapped
  35.  
  36. if !exists("did_cpp_syntax_inits")
  37.   let did_cpp_syntax_inits = 1
  38.   hi link cppClassDecl    Typedef
  39.   hi link cppClassPreDecl    cppStatement
  40.   hi link cppScopeDecl    cppStatement
  41.   hi link cppCast    cppStatement
  42.   hi link cppExceptions    cppStatement
  43.   hi link cppMethod    cppFunction
  44.   hi link cppStatement    Statement
  45.   hi link cppType    Type
  46.   hi link cppMethod    Function
  47.   hi link cppFunction    Function
  48.   hi link cppStorageClass    StorageClass
  49.   hi link cppNumber    Number
  50.   hi link cppBoolean    Boolean
  51. endif
  52.  
  53. let b:current_syntax = "cpp"
  54.  
  55. " vim: ts=8
  56.